package com.markyao.mapper;

import com.markyao.vo.QueryParams;
import com.markyao.vo.pojo.ConfigInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ConfigInfoMapper {

    int insert(ConfigInfo configInfo);

    int delete(@Param("id") Long id);

    int update(ConfigInfo configInfo);

    ConfigInfo select();

    @Select("select id,data_id,group_id from config_info")
    List<ConfigInfo> selectList();

    @Select("select * from config_info where data_id=#{dataId}")
    ConfigInfo selectByDataId(String dataId);

    @Select("select id,data_id,group_id,app_name from config_info where app_name=#{appName}")
    List<ConfigInfo> selectByAppName(String appName);

    @Select("select * from config_info where id=#{id}")
    ConfigInfo selectById(Long id);

    int deleteBatch(String[] ids);

    List<ConfigInfo> selectByIds(String[] ids);

    @Select("select content from config_info where data_id =#{dataId} and group_id=#{groupId}")
    String selectByDataIdAndGroupId(@Param("dataId") String dataId, @Param("groupId") String groupId);

    int updateByDataId(ConfigInfo insertConfig);

    @Select("SELECT * FROM config_info ${sql}")
    List<ConfigInfo> selectByQuerySql(@Param("queryParam") QueryParams queryParams,@Param("sql") String sql);
}
